package com.jeesite.modules.dept.dao;

import com.jeesite.common.dao.CrudDao;
import com.jeesite.common.mybatis.annotation.MyBatisDao;
import com.jeesite.modules.dept.entity.Employees;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * dept_employeesDAO接口
 * @author ccz
 * @version 2025-03-20
 */
@MyBatisDao
public interface EmployeesDao extends CrudDao<Employees> {

    @Select("SELECT affiliated_unit, SUM(achievement_score) AS total_score\n" +
            "FROM employees\n" +
            "GROUP BY affiliated_unit\n" +
            "ORDER BY total_score DESC\n" +
            "LIMIT 5;")
    List<Map<String, Object>> listColumnData();

    @Select("SELECT affiliated_unit, COUNT(*) AS count_above_80\n" +
            "FROM employees\n" +
            "WHERE achievement_score > 80\n" +
            "GROUP BY affiliated_unit;")
    List<Map<String, Object>> listZheXianData();

    @Select("select * from employees where native_place = ${nativePlace}")
    List<Map<String, Object>> findName(@Param("nativePlace") String nativePlace);
}